package com.newtouch.bxzs.business.train.controller;

import com.newtouch.bxzs.business.config.MyLog;
import com.newtouch.bxzs.business.train.model.bo.UserCourseBO;
import com.newtouch.bxzs.business.train.model.bo.UserCoursePageBO;
import com.newtouch.bxzs.business.train.model.vo.UserCoursePageVO;
import com.newtouch.bxzs.business.train.model.vo.UserCourseVO;
import com.newtouch.bxzs.business.train.service.UserCourseService;
import com.newtouch.bxzs.common.base.response.BaseResponse;
import com.newtouch.bxzs.common.base.response.RespGenerator;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 用户课程管理controller类
 *
 * <p>
 * <b>History:</b>
 * <table border="1">
 * <tr>
 * <th>Date</th>
 * <th>Operator</th>
 * <th>Memo</th>
 * </tr>
 * <tr>
 * <td>2021/2/23 9:49</td>
 * <td>dingqianbin</td>
 * <td>Create</td>
 * </tr>
 * </table>
 *
 * @author dingqianbin
 * @version 1.0.0
 * @since 1.0.0
 */
@Api(tags = "用户课程管理")
@RestController
@RequestMapping(value = "/userCourserController")
@SuppressWarnings("unchecked")
public class UserCourseController {

    private static final Log logger = LogFactory.getLog(UserCourseController.class);

    @Autowired
    UserCourseService userCourseService;

    @ApiOperation(value = "增加/修改用户课程信息")
    @PostMapping("/modifyUserCourser")
    @MyLog(systemFunctionName = "用户课程管理", systemFunctionUrl = "/userCourserController/modifyUserCourser", userOperationType = 5, userOperationSummary = "增加/修改用户课程信息")
    public BaseResponse<UserCourseBO> modifyUserCourser(@RequestBody UserCourseVO userCourseVO) {
        logger.info("增加/修改用户课程信息");
        return RespGenerator.returnOK(userCourseService.modifyUserCourser(userCourseVO));
    }

    @ApiOperation(value = "查询我的课程/历史记录列表信息")
    @PostMapping("/getUserCourseList")
    @MyLog(systemFunctionName = "用户课程管理", systemFunctionUrl = "/userCourserController/getUserCourseList", userOperationType = 4, userOperationSummary = "查询我的课程/历史记录列表信息")
    BaseResponse<UserCoursePageBO> getUserCourseList(@RequestBody UserCoursePageVO userCoursePageVO) {
        logger.info("查询我的课程/历史记录列表信息");
        return RespGenerator.returnOK(userCourseService.getUserCourseList(userCoursePageVO));
    }

}
